"""
练习1：定义函数,在列表中找出所有偶数 [43,43,54,56,76,87,98]
"""
list1 = [43,43,54,56,76,87,98]

# 定义生成器函数
def get_even(nums):
    for num in nums:
        if num % 2 == 0:
            yield num

# 调用生成器函数
for i in get_even(list1):
    print(i)